package com.example.shengyin.config;

import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Properties;

/**
 * @author oldliu
 * @since 1.0
 */
@Configuration
public class ShengConfig implements WebMvcConfigurer {

    @Value("${upload-path}")
    private String uploadpath;

    @Value("${upload-type}")
    private int type;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        if (type == 1) {
            registry.addResourceHandler("/img/**")
                    .addResourceLocations("file:" + "/opt/df/img/");
        }
        if (type == 0) {
            registry.addResourceHandler("/img/**")
                    .addResourceLocations("file:" + "D:\\Temp\\");
        }


    }

}
